package com.vanke.vms.management.action;

import java.util.List;

import com.vanke.vms.common.action.BaseAction;
import com.vanke.vms.common.domain.User;
import com.vanke.vms.management.service.ListMemberService;

public class ListMemberAction extends BaseAction {

	private static final long serialVersionUID = 2844217544576751006L;

	private ListMemberService listMemberService;

	private List<User> memberList;

	public String showMemberList() {

		if (session.get("user") == null)
			return LOGIN;
		else {
			if (((User) session.get("user")).getLevel() == 0)
				memberList = listMemberService
						.getMemberList(this.getTeamName());
			else {
				memberList = listMemberService.getMyInformation(((User) session
						.get("user")).getUsername());
			}

			return SUCCESS;
		}

	}

	private String getTeamName() {
		return ((User) session.get("user")).getTeam();
	}

	public ListMemberService getListMemberService() {
		return listMemberService;
	}

	public void setListMemberService(ListMemberService listMemberService) {
		this.listMemberService = listMemberService;
	}

	public List<User> getMemberList() {
		return memberList;
	}

	public void setMemberList(List<User> memberList) {
		this.memberList = memberList;
	}

}
